

package examples.radio;

import commandz.cli.*;
import java.util.Collection;


/**
 *  Command that sets the reception-mode of a given Radio to Frequency Modulation.
 */
public final class FrequencyModulationCommand implements Command
{
    private Radio radio;


    public FrequencyModulationCommand(Radio radio)
    {
        this.radio = radio;
    }


    public String getName()
    {
        return "fm";
    }


    public String getDescription()
    {
        return "Lets the radio receive by means of Frequency Modulation.";
    }


    public void publishParameters(Collection<Parameter> params)
    {
        // No parameters required.
    }


    public void execute()
    {
        this.radio.setFrequencyModulation(true);

        System.out.printf("Modulation: %s.\n", this.radio.getModulation());
    }
}
